<?php

use Phinx\Migration\AbstractMigration;
use Phinx\Db\Adapter\MysqlAdapter;

class CarCalendar extends AbstractMigration
{
    public function up()
    {
        $users = $this->table('caravan_calendar', array('comment' => '会员房车时间段状态表'));
        $users->addColumn('user_id', 'integer')
              ->addColumn('caravan_id', 'integer')
              ->addColumn('camp_id', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'default' => 1, 'comment' => ''))
              ->addColumn('branch_id', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'default' => 0))
              ->addColumn('car_area', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'default' => 0))
              ->addColumn('sign', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'comment' => '类型'))
              ->addColumn('s', 'date', array('comment' => ''))
              ->addColumn('e', 'date', array('comment' => ''))
              ->addColumn('created_at', 'timestamp', array('null' => true))
              ->addColumn('updated_at', 'timestamp', array('null' => true))
              ->addIndex('caravan_id')
              ->save();     
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('caravan_calendar');
    }
}
